home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 11012 / Blender249[Oddworld Stranger's Wrath][PC][SMD][2016-06-04].7z / Blender249[Oddworld Stranger's Wrath][PC][SMD][2016-06-04] / starter.py < prev   
Encoding:
Python Source  |  2016-06-04  |  14.8 KB  |  607 lines

  1. import newGameLib
  2. from newGameLib import *
  3. import Blender    
  4.  
  5.  
  6. getAll=1
  7.  
  8. def setBox(box,meshList):
  9.     E=[[],[],[]]
  10.     for mesh in meshList:
  11.         for n in range(len(mesh.vertPosList)):
  12.             x,y,z=mesh.vertPosList[n]
  13.             E[0].append(x)
  14.             E[1].append(y)
  15.             E[2].append(z)    
  16.     skX=(box[3]-box[0])/(max(E[0])-min(E[0]))
  17.     skY=(box[4]-box[1])/(max(E[1])-min(E[1]))
  18.     skZ=(box[5]-box[2])/(max(E[2])-min(E[2]))
  19.     sk=min(skX,skY,skZ)
  20.     trX1=(box[3]+box[0])/2#-(max(E[0])+min(E[0]))/2
  21.     trY1=(box[4]+box[1])/2#-(max(E[1])+min(E[1]))/2
  22.     trZ1=(box[5]+box[2])/2#-(max(E[2])+min(E[2]))/2
  23.     
  24.     trX=-(max(E[0])+min(E[0]))/2
  25.     trY=-(max(E[1])+min(E[1]))/2
  26.     trZ=-(max(E[2])+min(E[2]))/2
  27.     #print trX,trY,trZ
  28.     #print skX,skY,skZ
  29.     
  30.     for mesh in meshList:
  31.         for n in range(len(mesh.vertPosList)):
  32.             x,y,z=mesh.vertPosList[n]
  33.             mesh.vertPosList[n]=[x+trX,y+trY,z+trZ]
  34.         for n in range(len(mesh.vertPosList)):
  35.             x,y,z=mesh.vertPosList[n]
  36.             mesh.vertPosList[n]=[x*skX,y*skY,z*skZ]
  37.         for n in range(len(mesh.vertPosList)):
  38.             x,y,z=mesh.vertPosList[n]
  39.             mesh.vertPosList[n]=[x+trX1,y+trY1,z+trZ1]
  40.         #mesh.draw()    
  41.  
  42.     
  43.         
  44. def smbParser(filename,g):
  45.  
  46.  
  47.     dirPath=g.dirname+os.sep+g.basename+'_files'
  48.     if os.path.exists(dirPath)==False:os.makedirs(dirPath)
  49.     
  50.  
  51.  
  52.     g.word(4)
  53.     fileCount=g.i(1)[0]
  54.     g.word(g.i(1)[0])
  55.     A=g.i(9)
  56.     nodeList=[]
  57.     for m in range(A[6]):
  58.         start=g.tell()
  59.         B=g.i(7)
  60.         t=g.tell()
  61.         g.i(3)
  62.         name=g.word(g.i(1)[0])
  63.         g.i(10)
  64.         info=[]
  65.         nodeList.append([B,name,info,start])
  66.         g.seek(t+B[5])
  67.     
  68.     start=0    
  69.     for i,node in enumerate(nodeList):
  70.         if node[0][1] in [0]:
  71.             headPath=dirPath+os.sep+os.path.basename(node[1]+'.meshinfo')
  72.             new=open(headPath,'wb')
  73.             g.seek(node[3])
  74.             new.write(g.read(node[0][5]+28))
  75.             new.close()
  76.             
  77.         """if node[0][1] in [6]:#gr2
  78.             headPath=dirPath+os.sep+os.path.basename(node[1])
  79.             new=open(headPath,'wb')
  80.             g.seek(node[3])
  81.             new.write(g.read(node[0][5]+28))
  82.             new.close()"""
  83.             
  84.         if node[0][1] in [1]:
  85.             headPath=dirPath+os.sep+os.path.basename(node[1]+'.imageinfo')
  86.             new=open(headPath,'wb')
  87.             g.seek(node[3])
  88.             new.write(g.read(node[0][5]+28))
  89.             new.close()
  90.             
  91.         if node[0][1] in [1]:
  92.             dataPath=dirPath+os.sep+os.path.basename(node[1]+'.data')
  93.             new=open(dataPath,'wb')
  94.             g.seek(A[0]+A[2]+node[0][4])
  95.             if i<len(nodeList)-1:
  96.                 new.write(g.read(nodeList[i+1][0][4]-nodeList[i][0][4]))
  97.             new.close()
  98.             
  99.         if node[0][1] in [6]:
  100.             dataPath=dirPath+os.sep+os.path.basename(node[1])
  101.             new=open(dataPath,'wb')
  102.             g.seek(A[0]+A[2]+node[0][4])
  103.             if i<len(nodeList)-1:
  104.                 new.write(g.read(nodeList[i+1][0][4]-nodeList[i][0][4]))
  105.             new.close()
  106.             
  107.         if node[0][1] in [20]:
  108.             headPath=dirPath+os.sep+g.basename+'_'+str(i).zfill(2)+'.skeleton'
  109.             new=open(headPath,'wb')
  110.             g.seek(node[3])
  111.             new.write(g.read(node[0][5]+28))
  112.             new.close()
  113.         
  114.     start=0    
  115.     for i,node in enumerate(nodeList):
  116.         #print i,node[1]
  117.         end=node[0][3]
  118.         if end-start>0:
  119.             if nodeList[i-1][0][1] in [0,1]:
  120.                 filePath=dirPath+os.sep+os.path.basename(nodeList[i-1][1]+'.data')
  121.                 new=open(filePath,'wb')
  122.                 g.seek(A[0]+start)
  123.                 new.write(g.read(end-start))
  124.                 new.close()
  125.                 
  126.             if nodeList[i-1][0][1] in [0]:
  127.                 filePath=dirPath+os.sep+os.path.basename(nodeList[i-1][1]+'.data2')
  128.                 new=open(filePath,'wb')
  129.                 g.seek(A[0]+A[2])
  130.                 new.write(g.read(A[3]))
  131.                 new.close()
  132.         start=end
  133.     if nodeList[i][0][1] in [0,1]:
  134.         filePath=dirPath+os.sep+os.path.basename(nodeList[i][1]+'.data')
  135.         new=open(filePath,'wb')
  136.         g.seek(A[0]+nodeList[i][0][3])
  137.         new.write(g.read(A[2]-nodeList[i][0][3]))
  138.         new.close()
  139.         
  140.         
  141. def meshinfoParser(filename,g):    
  142.     HEAD=g.i(10)
  143.     
  144.     model=Model(filename)
  145.     model.meshBindBoneList=[]
  146.     model.meshBindBoneList1=[]
  147.     model.boneMapInfoList=[]
  148.     model.meshListBB=[]
  149.     model.texDiffList=[]
  150.     model.geoName=g.word(g.i(1)[0])
  151.     g.i(2)
  152.     g.i(g.i(1)[0]*2)
  153.     g.i(3)
  154.     g.f(1)
  155.     model.boundingBox=g.f(6)
  156.     C=g.i(3)
  157.     for n in range(C[2]):        
  158.         D=g.i(12)
  159.         g.f(3)
  160.         g.i(2)
  161.         g.f(6)
  162.         g.word(g.i(1)[0])
  163.         g.word(g.i(1)[0])
  164.         g.word(g.i(1)[0])
  165.         g.f(4)
  166.         #print n,D
  167.         if D[2]==6:
  168.             g.word(g.i(1)[0])
  169.             g.i(2)
  170.             g.word(g.i(1)[0])
  171.             model.texDiffList.append(g.dirname+os.sep+os.path.basename(g.word(g.i(1)[0])).split('.')[0]+'.dds')
  172.             g.word(g.i(1)[0])
  173.             g.i(1)
  174.             g.word(g.i(1)[0])
  175.             g.B(13)
  176.         if D[2]==2:
  177.             g.word(g.i(1)[0])
  178.             g.i(2)
  179.             g.word(g.i(1)[0])
  180.             model.texDiffList.append(g.dirname+os.sep+os.path.basename(g.word(g.i(1)[0])).split('.')[0]+'.dds')
  181.             g.word(g.i(1)[0])
  182.             g.i(2)
  183.             g.word(g.i(1)[0])
  184.             g.i(2)
  185.             g.word(g.i(1)[0])
  186.         if D[2]==1:
  187.             g.word(g.i(1)[0])
  188.             g.i(2)
  189.             g.word(g.i(1)[0])
  190.             model.texDiffList.append(g.dirname+os.sep+os.path.basename(g.word(g.i(1)[0])).split('.')[0]+'.dds')
  191.             g.i(2)
  192.             g.word(g.i(1)[0])
  193.         if D[2]==0:    
  194.             E=g.i(4)
  195.             flag=g.i(1)[0]    
  196.             #print flag,g.tell(),n,C[2]    
  197.             if flag!=737893 and flag>10:
  198.                 g.seek(-4,1)
  199.                 model.texDiffList.append(g.dirname+os.sep+os.path.basename(g.word(g.i(1)[0])).split('.')[0]+'.dds')
  200.                 K=g.i(2)                    
  201.                 g.word(g.i(1)[0])
  202.             else:
  203.                 g.seek(-4,1)
  204.                 model.texDiffList.append('None')
  205.         
  206.     count=g.i(1)[0]
  207.     for n in range(count):
  208.         g.i(3)
  209.         g.H(1)    
  210.         g.i(5)
  211.         g.i(2)
  212.         g.word(g.i(1)[0])
  213.         g.i(2)
  214.         g.word(g.i(1)[0])
  215.         g.i(6)
  216.         g.word(g.i(1)[0])
  217.         g.i(2)
  218.         g.word(g.i(1)[0])
  219.         g.i(9)
  220.     count=g.i(1)[0]
  221.     for n in range(count):
  222.         mesh=Mesh()
  223.         model.meshList.append(mesh)
  224.         mesh.a=None
  225.         mesh.b=None
  226.         mesh.c=None
  227.         a=g.H(21)
  228.         b=g.i(10)
  229.         mesh.a=a
  230.         mesh.b=b
  231.         if b[8]==0:
  232.             mesh.c=g.i(2)
  233.     if g.tell()<g.fileSize():    
  234.         D=g.i(4)
  235.         if D[0]==10:
  236.             model.boneNameList=g.word(D[3]).split('|')
  237.             count=g.i(1)[0]
  238.             for m in range(count):
  239.                 g.f(7)    
  240.             count=g.i(1)[0]
  241.             model.meshBindBoneList=[]
  242.             model.meshBindBoneList1=[]
  243.             for n in range(count):
  244.                 model.meshBindBoneList.append(g.B(2))    
  245.             count=g.i(1)[0]
  246.             model.boneMapInfoList=[]
  247.             for n in range(count):
  248.                 model.boneMapInfoList.append(g.B(4))
  249.                 print n,model.boneMapInfoList[-1]    
  250.             count=g.i(1)[0]
  251.             for n in range(count):
  252.                 model.meshBindBoneList1.append(g.B(4))    
  253.             count=g.i(1)[0]
  254.             model.boneMap=[]
  255.             for n in range(count):
  256.                 model.boneMap.append(g.B(1)[0])
  257.             g.i(3)
  258.         else:
  259.             g.seek(-16,1)
  260.         
  261.     #print model.texDiffList    
  262.     dataPath=g.dirname+os.sep+g.basename+'.geo.data'
  263.     if os.path.exists(dataPath)==True:    
  264.         file=open(dataPath,'rb')
  265.         p=BinaryReader(file)
  266.         for i,mesh in enumerate(model.meshList):
  267.             mat=Mat()
  268.             mesh.matList.append(mat)
  269.             mat.TRISTRIP=True
  270.             try:
  271.                 mat.diffuse=model.texDiffList[i]
  272.                 if os.path.exists(mat.diffuse)==False:
  273.                     print 'no image:',mat.diffuse
  274.             except:
  275.                 print 'no image:',mat.diffuse
  276.             p.seek(mesh.b[7])
  277.             print i,mesh.b
  278.             if mesh.b[5]==0:
  279.                 for m in range(mesh.b[3]):
  280.                     mesh.vertPosList.append(p.f(3))
  281.             elif mesh.b[5]==89:
  282.                 for m in range(mesh.b[3]):
  283.                     mesh.skinIndiceList.append(p.B(2))
  284.                     mesh.skinWeightList.append(p.B(2))
  285.                     mesh.vertUVList.append(p.short(2,'h',11))
  286.                     mesh.vertPosList.append(p.f(3))
  287.             elif mesh.b[5]==114:
  288.                 for m in range(mesh.b[3]):
  289.                     mesh.skinIndiceList.append(p.B(2))
  290.                     mesh.skinWeightList.append(p.B(2))
  291.                     mesh.vertUVList.append(p.short(2,'h',11))
  292.                     mesh.vertPosList.append(p.short(3,'h',16))
  293.             elif mesh.b[5]==116:
  294.                 for m in range(mesh.b[3]):
  295.                     mesh.vertUVList.append(p.short(2,'h',11))
  296.                     p.B(4)
  297.                     mesh.vertPosList.append(p.short(3,'h',16))
  298.             elif mesh.b[5]==119:
  299.                 for m in range(mesh.b[3]):
  300.                     mesh.skinIndiceList.append(p.B(2))
  301.                     mesh.skinWeightList.append(p.B(2))
  302.                     mesh.vertUVList.append(p.short(2,'h',11))
  303.                     p.B(4)
  304.                     mesh.vertPosList.append(p.short(3,'h',16))
  305.             elif mesh.b[5]==121:
  306.                 for m in range(mesh.b[3]):
  307.                     mesh.vertUVList.append(p.short(2,'h',11))
  308.                     p.B(4)
  309.                     mesh.vertPosList.append(p.short(3,'h',16))
  310.             elif mesh.b[5]==122:
  311.                 for m in range(mesh.b[3]):
  312.                     mesh.skinIndiceList.append(p.B(2))
  313.                     mesh.skinWeightList.append(p.B(2))
  314.                     mesh.vertUVList.append(p.short(2,'h',11))
  315.                     p.B(4)
  316.                     mesh.vertPosList.append(p.short(3,'h',16))
  317.             else:
  318.                 print 'UNKNOW MESH TYPE:',mesh.b[5]
  319.                 break
  320.                     
  321.             if mesh.c is not None:
  322.                 p.seek(mesh.b[9])
  323.                 p.H(4)                
  324.                 while(True):
  325.                     B=p.H(2)
  326.                     t=p.tell()
  327.                     if B[1]==24572:
  328.                         indiceList=p.H(4094)
  329.                         mesh.indiceList.extend(indiceList)
  330.                         p.seek(t+8188)
  331.                     else:
  332.                         indiceCount=mesh.c[1]-len(mesh.indiceList)-1    
  333.                         indiceList=    p.H(indiceCount)
  334.                         mesh.indiceList.extend(indiceList)
  335.                         break
  336.             else:
  337.                 data2Path=g.dirname+os.sep+g.basename+'.geo.data2'
  338.                 if os.path.exists(data2Path)==True:
  339.                 
  340.                     file2=open(data2Path,'rb')
  341.                     r=BinaryReader(file2)
  342.                     r.seek(HEAD[4]+mesh.b[9])
  343.                     #print r.tell()
  344.                     mesh.indiceList=r.H(mesh.b[8])
  345.                     file2.close()
  346.             if mesh.b[5] not in [0,89]:
  347.                 model.meshListBB.append(mesh)
  348.                 
  349.                 """skin=Skin()
  350.                 for boneMapInfo in model.boneMapInfoList:
  351.                     if boneMapInfo[0]==i:
  352.                         idStart=boneMapInfo[1]
  353.                         idCount=boneMapInfo[2]
  354.                         skin.boneMap=model.boneMap[idStart:idStart+idCount]
  355.                         mesh.boneNameList=model.boneNameList
  356.                 mesh.skinList.append(skin)
  357.                 mesh.BINDSKELETON='armature'
  358.                 mesh.draw()"""
  359.             #else:
  360.             #    model.meshListBB.append(mesh)
  361.                 
  362.                 
  363.         file.close()        
  364.                 
  365.         box=model.boundingBox
  366.         if len(model.meshListBB)>0:
  367.             setBox(box,model.meshListBB)
  368.             
  369.         for i,mesh in enumerate(model.meshList):
  370.             skin=Skin()
  371.             
  372.             
  373.             for info in model.boneMapInfoList:
  374.                 if info[0]==i:
  375.                     print '0',i,info,len(model.boneNameList)
  376.                     idStart=info[1]
  377.                     idCount=info[2]
  378.                     skin.boneMap=model.boneMap[idStart:idStart+idCount]
  379.                     mesh.boneNameList=model.boneNameList
  380.             for info in model.meshBindBoneList:
  381.                 if info[0]==i:
  382.                     print '1',i,info,len(model.boneNameList)
  383.                     skin.boneMap=[info[1]]
  384.                     mesh.boneNameList=model.boneNameList
  385.                     for m in range(len(mesh.vertPosList)):
  386.                         mesh.skinIndiceList.append([0])
  387.                         mesh.skinWeightList.append([1.0])
  388.             """for info in model.meshBindBoneList1:
  389.                 print i,info
  390.                 if info[0]==i:
  391.                     skin.boneMap=[info[1]]
  392.                     mesh.boneNameList=model.boneNameList
  393.                     for m in range(len(mesh.vertPosList)):
  394.                         mesh.skinIndiceList.append([0])
  395.                         mesh.skinWeightList.append([1.0])"""
  396.                         
  397.             mesh.skinList.append(skin)
  398.             
  399.             
  400.             
  401.             mesh.BINDSKELETON='armature'
  402.             mesh.draw()    
  403.         
  404.     
  405. def skeletoninfoParser(filename,g):    
  406.     HEAD=g.i(7)
  407.     #g.logskip=True
  408.     skeleton=Skeleton()
  409.     skeleton.ARMATURESPACE=True
  410.     skeleton.NICE=True
  411.     skeleton.BINDMESH=True
  412.     C=g.i(4)
  413.     g.word(C[3])
  414.     size=g.i(1)[0]
  415.     t1=g.tell()
  416.     g.seek(t1+size)
  417.     boneCount=g.i(1)[0]
  418.     
  419.     txt=open('hashlist.txt','w')
  420.     
  421.     for n in range(boneCount):
  422.         bone=Bone()
  423.         skeleton.boneList.append(bone)
  424.         bone.matrix=Matrix4x4(g.f(16)).invert()
  425.         g.i(2)
  426.         g.f(7)
  427.         D=g.i(3)
  428.         bone.parentID=D[1]
  429.         bone.hash=str(D[0])
  430.         
  431.     for n in range(boneCount):
  432.         bone=skeleton.boneList[n]
  433.         off=g.i(1)[0]
  434.         tn=g.tell()
  435.         g.seek(t1+off)                
  436.         bone.name=g.find('\x00')[-25:]
  437.         g.seek(tn)
  438.         txt.write(bone.hash+':'+bone.name+'\n')
  439.     skeleton.draw()
  440.     #g.logskip=False
  441.     txt.close()
  442.         
  443. def imageinfoParser(filename,g):
  444.     g.i(10)
  445.     name=g.word(g.i(1)[0])
  446.     g.i(4)
  447.     g.B(1)
  448.     info=g.i(9)
  449.     
  450.     dataPath=filename.replace('.imageinfo','.data')
  451.     #print dataPath
  452.     if os.path.exists(dataPath)==True:
  453.     
  454.         file=open(dataPath,'rb')
  455.         p=BinaryReader(file)
  456.     
  457.     
  458.         obrazek=Obrazek()
  459.         filePath=g.dirname+os.sep+g.basename
  460.         #print info
  461.         obrazek.wys=info[2]
  462.         obrazek.szer=info[3]
  463.         if info[1]==12:
  464.             obrazek.format='DXT1'
  465.             obrazek.name=filePath+'.dds'
  466.             obrazek.wys=info[3]
  467.             obrazek.szer=info[2]
  468.         if info[1]==15:
  469.             obrazek.format='DXT5'
  470.             obrazek.name=filePath+'.dds'
  471.             obrazek.wys=info[3]
  472.             obrazek.szer=info[2]
  473.         if info[1]==18:
  474.             obrazek.format='tga32'
  475.             obrazek.name=filePath+'.tga'
  476.         if info[1]==14:
  477.             obrazek.format='DXT3'
  478.             obrazek.name=filePath+'.dds'
  479.             obrazek.wys=info[3]
  480.             obrazek.szer=info[2]
  481.         obrazek.data=p.read(p.fileSize())
  482.         obrazek.save()
  483.         
  484.         file.close()
  485.         
  486. def gr2Parser(filename,p):
  487.     
  488.     hashPath='hashlist.txt'
  489.     hashList={}
  490.     if os.path.exists(hashPath)==True:
  491.         txt=open(hashPath,'r')
  492.         for line in txt.readlines():
  493.             if ':' in line:
  494.                 split=line.strip().split(':')
  495.                 #print split
  496.                 hashList[split[0]]=split[1]
  497.         
  498.     
  499.     p.i(20)
  500.     p.i(6)
  501.     p.f(12)
  502.     p.i(2)
  503.     A=p.i(14)
  504.     p.f(10)
  505.     
  506.     p.i(8)
  507.     action=Action()
  508.     action.BONESORT=True
  509.     action.BONESPACE=True
  510.     for m in range(A[3]):
  511.         bone=ActionBone()
  512.         bone.name=str(m)
  513.         action.boneList.append(bone)
  514.         bone.info=p.i(16)
  515.         bone.name=str(bone.info[0])
  516.         if str(bone.info[0]) in hashList:
  517.             bone.name=hashList[str(bone.info[0])]
  518.         
  519.     for bone in action.boneList:
  520.         if bone.info[2]>0:
  521.             p.seek(bone.info[3])
  522.             for m in range(bone.info[2]):
  523.                 time=p.f(1)[0]*33
  524.                 bone.posFrameList.append(time)
  525.             p.seek(bone.info[5])
  526.             for m in range(bone.info[2]):
  527.                 bone.posKeyList.append(VectorMatrix(p.f(3)))
  528.         if bone.info[7]>0:    
  529.             p.seek(bone.info[8])
  530.             for m in range(bone.info[7]):
  531.                 time=p.f(1)[0]*33
  532.                 bone.rotFrameList.append(time)
  533.             p.seek(bone.info[10])
  534.             for m in range(bone.info[7]):
  535.                 bone.rotKeyList.append(QuatMatrix(p.f(4)).resize4x4())
  536.             #break    
  537.     action.draw()
  538.     action.setContext()    
  539.     
  540. def Parser(filename):    
  541.     print '='*70
  542.     print filename
  543.     print '='*70
  544.     ext=filename.split('.')[-1].lower()    
  545.     
  546.     if ext=='smb':
  547.         file=open(filename,'rb')
  548.         g=BinaryReader(file)
  549.         smbParser(filename,g)
  550.         file.close()    
  551.     
  552.     if ext=='meshinfo':
  553.  
  554.                 
  555.         file=open(filename,'rb')
  556.         g=BinaryReader(file)
  557.         #g.logOpen()
  558.         meshinfoParser(filename,g)
  559.         #g.logClose()
  560.         file.close()    
  561.     
  562.     if ext=='skeleton':
  563.         file=open(filename,'rb')
  564.         g=BinaryReader(file)
  565.         skeletoninfoParser(filename,g)
  566.         file.close()
  567.  
  568.         if getAll==1:    
  569.         
  570.             for file in os.listdir(os.path.dirname(filename)):
  571.                 if file.split('.')[-1].lower()=='imageinfo':
  572.                     filePath=os.path.dirname(filename)+os.sep+file
  573.                     file=open(filePath,'rb')
  574.                     g=BinaryReader(file)
  575.                     imageinfoParser(filePath,g)
  576.                     file.close()    
  577.                     
  578.             
  579.             for file in os.listdir(os.path.dirname(filename)):
  580.                 if file.split('.')[-1].lower()=='meshinfo':
  581.                     #print file
  582.                     filePath=os.path.dirname(filename)+os.sep+file
  583.                     file=open(filePath,'rb')
  584.                     g=BinaryReader(file)
  585.                     #g.logOpen()
  586.                     meshinfoParser(filePath,g)
  587.                     #g.logClose()
  588.                     file.close()
  589.     
  590.     if ext=='imageinfo':
  591.         for file in os.listdir(os.path.dirname(filename)):
  592.             if file.split('.')[-1].lower()=='imageinfo':
  593.                 filePath=os.path.dirname(filename)+os.sep+file
  594.                 file=open(filePath,'rb')
  595.                 g=BinaryReader(file)
  596.                 imageinfoParser(filePath,g)
  597.                 file.close()    
  598.     
  599.     if ext=='gr2':        
  600.         file=open(filename,'rb')
  601.         g=BinaryReader(file)        
  602.         gr2Parser(filename,g)
  603.         file.close()
  604.  
  605.     
  606. Blender.Window.FileSelector(Parser,'import','select: *.smb, *.skeleton, *.meshinfo, *.imageinfo') 
  607.